/*
 * @Author: lyx 2858535420@qq.com
 * @Date: 2023-03-07 14:18:54
 * @LastEditors: lyx 2858535420@qq.com
 * @LastEditTime: 2023-03-07 14:42:27
 * @FilePath: /bangand-low-code/src/directives/index.js
 * @Description: 动态导入加载 modules
 */

// 加载 modules 下面所有的指令文件
const dirs = require.context('./modules', true, /\.js$/);

export default {
  install: (app) => {
    dirs.keys().map((item) => {
      let moduleName = item.replace(/^\.\/(.*)\.\w+$/, '$1'),
        module = dirs(item);

      app.directive(moduleName, module.default || module);
    });
  }
};
